<template>
  <div class="photoinfo">
    <h3>{{photos.title}}</h3>
    <div class="span">
      <span>发表时间：{{photos.add_time|moment}}</span>
      <span>点击次数{{photos.click}}次</span>
    </div>
    <hr>
    <div class="content" v-html="photos.content"></div>
    <!-- 子组件。。。 -->
    <cmt-box :id="id"></cmt-box>
  </div>
</template>

<script>
import comment from "../subcomponents/comment.vue";

export default {
  data() {
    return {
      id: this.$route.query.id,
      photos: {}
    };
  },

  methods: {
    getPhotoList() {
      this.$http.get("api/getimageInfo/" + this.id).then(res => {
        console.log(res.body);
        if (res.body.status === 0) {
          this.photos = res.body.message[0];
        }
      });
    }
  },

  created() {
    this.getPhotoList();
  },
  components: {
    "cmt-box": comment
  }
};
</script>

<style lang='less' scoped>
.photoinfo {
  .span {
    display: flex;
    justify-content: space-between;
  }
}
</style>
